import fetch from 'common/src/utils/fetch'




/**
 * 查询列表
 */
function searchList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/page2', // TODO page2
        method: 'post',
        data: data
    });
}

/**
 * 查询列表
 */
function searchApprovalList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/searchApprovalList', // TODO page2
        method: 'post',
        data: data
    });
}


function exportList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/export',
        method: 'post',
        data: data
    });
}
function shortApply(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/shortApply',
        method: 'post',
        data: data
    });
}
function longApply(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/longApply',
        method: 'post',
        data: data
    });
}

function saveAsDraft(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/saveAsDraft',
        method: 'post',
        data: data
    });
}

/**
 * 撤回的接口，内部进行调用工作流，并将原来的状态更改为草稿中
 * @param {} data
 */
function recall(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/recall',
        method: 'post',
        data: data
    });
}

function applyPass(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/applyPass',
        method: 'post',
        data: data
    })
}

function exportAll(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/export',
        method: 'post',
        data: data
    })
}

function updateExportedStatus(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/updateExportStatus',
        method: 'post',
        data: data
    })
}

function getTeachingClassList(string, deleteCode) {
    return fetch({
        url: `/api/arrangementservice/teachingClass/teachClass/getList?string=${string}&deleteCode=${deleteCode}`,
        method: 'get'
    })
}

function getTeachingClass(string, calendarId) {
    return fetch({
        url: `/api/electionservice/elcResult/getTeachingClass?classCode=${string}&calendarId=${calendarId}`,
        method: 'get'
    })
}

function checkRestrict(data) {
    return fetch({
        url: `/api/arrangementservice/teachingClassChange/checkRestrict`,
        method: 'post',
        data: data
    })
}

function getStudentConflict(id,isCheck) {
    return fetch({
        url: `/api/arrangementservice/teachingClassChange/getStudentConflict?id=${id}&isCheck=${isCheck}`,
        method: 'get'
    })
}

/**
 * 作废处理接口，将‘审批通过’状态更新为‘作废’状态
 * @param {} data
 */
function abandon(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/abandon',
        method: 'post',
        data: data
    });
}

/**
 * 根据工作流NO查询关联调课信息明细
 */
function getClassChangeInfoByWorkflowNO(workflowNO) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/getClassChangeInfoByWorkflowNO?workflowNO=' + workflowNO,
        method: 'get'
    });
}

export default {
    "searchList": searchList,
    "exportList": exportList,
    "shortApply": shortApply,
    "longApply": longApply,
    "searchApprovalList": searchApprovalList,
    "applyPass": applyPass,
    "exportAll": exportAll,
    "updateExportedStatus": updateExportedStatus,
    "getTeachingClassList": getTeachingClassList,
    "getTeachingClass": getTeachingClass,
    "checkRestrict": checkRestrict,
    "saveAsDraft": saveAsDraft,
    "recall": recall,
    "getStudentConflict": getStudentConflict,
    "abandon": abandon,
    "getClassChangeInfoByWorkflowNO": getClassChangeInfoByWorkflowNO
}
